<template>
	<div>
		<ContentWrap>
			
			<!-- 列表 -->
			<el-table v-loading="loading" :data="list" style="margin-top: 20px" stripe>
				<el-table-column align="center" label="ID" prop="id" />
				<el-table-column align="center" label="用户" prop="nickname"/>
				<el-table-column align="center" label="文件" prop="fileName"/>
				<el-table-column align="center" label="问题" prop="question"/>
				<el-table-column align="center" label="评估" prop="feedback"/>
				<el-table-column align="center" label="调用方式" prop="type">
					<template #default="scope">
						<div>{{ scope.row.type === 1 ? "问答" : "上传" }}</div>
					</template>
				</el-table-column>
				<el-table-column
						align="center"
						label="创建时间"
						sortable
						prop="createTime"
						:formatter="dateFormatter"
				/>
			</el-table>
			<!-- 分页 -->
			<div class="flex align-items" style="justify-content: center">
				<Pagination
						v-model:limit="queryParams.pageSize"
						v-model:page="queryParams.pageNo"
						:total="total"
						@pagination="getList"
				/>
			</div>
		</ContentWrap>
	
	</div>
</template>

<script setup lang="ts">
import {dateFormatter} from '@/utils/formatTime'
import {GetOrgList} from '@/api/system/org'
import {operateLogPage} from "@/api/system/log";

const message = useMessage() // 消息弹窗

/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
  formRef.value.open(type, id)
}

const loading = ref(false) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数据
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
})

const orgList = ref([])
const apiGetOrgList = async () => {
  orgList.value = await GetOrgList()
}


/** 查询角色列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await operateLogPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}


onMounted(() => {
  apiGetOrgList()
  getList()
})
onUpdated(() => {
})
onUnmounted(() => {
})
</script>

<style scoped lang="scss"></style>
